import { ref } from 'vue'
import { defineStore } from 'pinia'
import { useCssVar } from '@vueuse/core'

export const useThemeStore = defineStore(
  'theme',
  () => {
    // 主色调
    const primaryColor = ref('#1677ff')
    const setPrimaryColor = (color) => {
      primaryColor.value = color
      useCssVar('--color').value = color
    }
    // 是否显示logo
    const showLogo = ref(true)
    const setShowLogo = (value) => {
      showLogo.value = value
    }
    // 页脚
    const showFooter = ref(true)
    const setShowFooter = (value) => {
      showFooter.value = value
    }
    return {
      primaryColor,
      setPrimaryColor,
      showLogo,
      setShowLogo,
      showFooter,
      setShowFooter,
    }
  },
  {
    persist: true,
  },
)
